package com.jd.jobkeeper.server.web.controller;

import com.jd.jobkeeper.server.data.entity.TaskInfo;
import com.jd.jobkeeper.server.service.TaskService;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/task")
public class TaskInfoController {

    final TaskService taskService;

    public TaskInfoController(TaskService taskService) {
        this.taskService = taskService;
    }

    @GetMapping("/{namespace}")
    public Page<TaskInfo> findAll(@PathVariable String namespace,
                                  @RequestParam(defaultValue = "1") int page,
                                  @RequestParam(defaultValue = "20") int size){
        return this.taskService.page(namespace,page,size);
    }
}
